<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>成交清算轧差</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- 注意：项目正式环境请勿引用该地址 -->
    <link rel="stylesheet" href="layui/css/layui.css"/>
    <script type="text/javascript" src="layui/layui.js"></script>
    <script type="text/javascript" src="layui/tableSelect.js"></script>
</head>
<body>

<table class="layui-hide" id="myTable" lay-filter="myTable"></table>

<script type="text/html" id="myToolbar">
    <form class="layui-form layui-col-space5">
        <div class="layui-inline layui-show-xs-block">
            <div class="layui-inline layui-show-xs-block">
                <input class="layui-input"  autocomplete="off" placeholder="请选择日期" name="dealTime" id="selectDate">
            </div>
        </div>
        <div class="layui-inline layui-show-xs-block">
            <button class="layui-btn layui-btn-primary" lay-submit="" lay-event="search" lay-filter="sreach"><i class="layui-icon">&#xe615;</i>搜索
            </button>
        </div>
    </form>
</script>
<script>
    layui.use(['element', 'form', 'table', 'layer', 'laydate'], function () {
        var layer = layui.layer;
        var $ = layui.$;
        var table = layui.table;
        var form = layui.form;
        var laydate = layui.laydate;


        //表单加载
        table.render({
            elem: '#myTable'
            , url: 'selectRollDifference'
            , toolbar: '#myToolbar' //开启头部工具栏，并为其绑定左侧模板
            , cellMinWidth: 150
            ,height:'full-55'
            , cols:
                [
                    [
                        {field: 'securitiesName', title:'证券名称',align: 'center'}
                        , {field: 'outMoney', title: '今日流出金额', align: 'center'}
                        , {field: 'inMoney', title: '今日流入金额', align: 'center'}
                        , {field: 'amountToday', title: '今日清算额', align: 'center'}
                        , {field: 'handle', title: '经手费', align: 'center'}
                        , {field: 'stampDuty', title: '印花税', align: 'center'}
                        , {field: 'transferFee', title: '过户费', align: 'center'}
                        , {field: 'control', title: '征管费', align: 'center'}
                        , {field: 'commissionFees', title: '佣金费用', align: 'center'}
                        , {field: 'netReceipts', title: '实际清算额', align: 'center'}
                    ]
                ]
            , page: true
        });
        laydate.render({
            elem: '#selectDate'
        });
        //给工具条的按钮事件
        table.on('toolbar(myTable)',function (obj) {
            alert("按钮事件")
            switch (obj.event) {
                case 'search':
                    var dealTime= $("#selectDate").val();
                    //alert(dateTime);
                    //表格的重新加载事件
                    table.reload('myTable', {
                        method: 'post'
                        , where: {
                            'dealTime': dealTime,
                        }
                        , page: {
                            curr: 1
                        }
                    });
                    laydate.render({
                        elem: '#selectDate',//指定元素
                    });
                    $("#selectDate").val(dealTime);
                    break;
            }
        });
    })

</script>

</body>
</html>